Ext.define('appmod.view.knowledge.category.UserPermList', {
    extend: 'Ext.grid.Panel',
    alias: [
		'widget.knowledge.category.userpermlist',
		'widget.knowledge-category-userpermlist'
		
	],
    margins:"5 5 5 5",
    region : 'center',
	requires:[
		'Ext.ux.form.SearchField'
	],	

    initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
            columns: [
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'userName',
					minWidth:200,
                    text: '用户名'
                },
				{
					xtype : 'gridcolumn',
					text: '访问角色',
					dataIndex : 'role',
	        		editor: {
	            		xtype: 'combobox',
	            		typeAhead: true,
	            		triggerAction: 'all',
	            		selectOnTab: true,
						editable :false,
	            		store: Ext.create('Ext.data.ArrayStore', {
							storeId:'selectId',
							fields:['label' , 'value'],
							data:[
								['不指定',''],
								['普通用户','user'],
								['栏目管理员','columnadmin'],
								['系统超级管理员','superadmin']
							]
						}),
						displayField:'label',
						valueField: 'value', 
	            		lazyRender: true,
	            		listClass: 'x-combo-list-small'
	        		},
					renderer:function(value) {
						if (value == 'superadmin' ) {
							return '系统超级管理员';
						} 
						else if ( value == 'columnadmin' ) {
							return '栏目管理员';
						}
						else if ( value == 'user' ) {
							return '普通用户';
						}
						else {
							return '不指定'
						}												
					}			
				}
            ],
            viewConfig: {

            },
			plugins: [
				Ext.create('Ext.grid.plugin.CellEditing', {
					clicktoEdit:2
    			})
			],			
            dockedItems: [
                {
                    xtype: 'toolbar',
                    dock: 'top',
                    items: [
                        {
							text:'保 存',
							action:'updateAuth' 
                        },'-',
						{
					        width: 250,
					        fieldLabel: '帐号查询',
					        labelWidth: 60,
					        xtype: 'searchfield'
					        //store: me.store
				        }						
                    ]
                }
            ],
			listeners:{
				
			}
        });

        me.callParent(arguments);
    },
	
	bindStore:function(store) {
		var me = this;
		
		var pagingbar = me.down('pagingtoolbar');
		pagingbar.bindStore(store);
		
		var searchField = me.down('searchfield');
		searchField.bindStore(store);
		me.callParent(arguments);		
	}
	
	
	
	
});